<?php require APP_ROOT.'public/top.php';?>
<?php
$type_id = pg('type_id');
$content_id = pg('content_id');
$table_name = pg('table_name');
$list = M($table_name)->where(array($table_name . '_id' => $content_id))->find();
?>

<div id="bread" style="background-color:#F2F2F2;padding:2px 10px;width:100%;z-index:999" class=""><a class="light-blue" href="/adplan/list">投放管理</a> &gt; <a class="light-blue" href="/adplan/modify/?plan_id="></a> &gt; 新建推广组</div>
<div class="estimatepv" style="position: relative; width: auto; top: 0px;"> <span>预计每日最大展现次数为&nbsp;:&nbsp; </span> <em class="red" id="llyd_count">619,236,386</em> </div>
<div id="g-body" class="g-bd f-cb" style="background:none">
  <div class="g-mn">
    <div id="g-content" class="g-ct" style="margin-left:0;position:relative">
      <h3 class="g-ct-title f-cb" style="border-bottom:none">
        <div style="float:left;line-height:30px;margin-left:5%;width:33%">
          <div class="step1-circle" style="background-color: darkgray; border-radius: 100px; float: left; height: 30px; line-height: 30px; text-align: center; width: 30px;"><span class="step1">1</span></div>
          <span class="step1-desc" style="color: darkgray; font-weight: normal; font-size: 14px;"> &nbsp;&nbsp;&nbsp;&nbsp;第一步 设置推广计划&nbsp;&nbsp;&nbsp;&nbsp;------------------------------------</span></div>
        <div style="float:left;line-height:30px;width:31%">
          <div class="step2-circle" style="background-color: rgb(0, 153, 60); border-radius: 100px; float: left; height: 30px; line-height: 30px; text-align: center; width: 30px;"><span class="step2">2</span></div>
          <span class="step2-desc" style="color: black; font-weight: bold; font-size: 14px;">&nbsp;&nbsp;&nbsp;&nbsp;第二步 设置推广组&nbsp;&nbsp;&nbsp;&nbsp;------------------------------------</span></div>
        <div style="float:left;line-height:30px;width:31%">
          <div class="step3-circle" style="align:center;background-color:darkgray;-webkit-border-radius:100px;float:left;height:30px;line-height:30px;text-align:center;width:30px"><span class="step3">3</span></div>
          <span class="step3-desc" style="color:darkgray;font-weight:700;font-size:14px"> &nbsp;&nbsp;&nbsp;&nbsp;第三步 设置推广创意</span></div>
      </h3>
      <form id="group-form" class="c-form" method="post" autocomplete="off" action="index.php?m=cms&a=edit_save" novalidate="novalidate" onsubmit="return return_message()">
     
		<input name="content_id" type="hidden" value="<?php echo $content_id;?>" />
		<input name="type_id" type="hidden" value="<?php echo $type_id;?>" />
        <input name="data[regionval]" type="hidden" id="regionval" value="<?php echo $list['regionval'];?>" />

        <div class="module">
          <dl class="f-cb">
            <dt>推广组名称: </dt>
            <dd>
              <p>
                <input id="group_name" class="c-input required" type="text" name="data[group_name]" value="<?php echo $list['group_name'];?>" maxlength="32">
              </p>
              <p class="f-gray">建议您根据媒体、人群或者活动内容来命名，以便于调整投放效果。</p>
              <p class="f-gray">当前最多可输入16个汉字或32个字符</p>
            </dd>
          </dl>
          <dl class="f-cb">
            <dt>推广计划选择: </dt>
            <dd>
              <label id="plan" class="w-select"> <i class="w-select-icon f-efonts">󰅰</i> <a href="javascript:void(0)" class="w-select-button"><?php echo M('plan')->where(array('plan_id'=>$list['plan_id']))->getfield('plan_name');?></a>
                <input type="hidden" id="plan_id" name="data[plan_id]" value="<?php echo $list['plan_id'];?>">
                <input type="hidden" name="os" id="slt_os" value="">
                <input type="hidden" name="appid" id="slt_appid" value="">
                <span class="w-select-lists" style="overflow-y: scroll; height: 200px;">
                <!--<input type="text" class="w-select-search" id="plan-search" placeholder="搜索看看">-->
                <?php
		$plan = M('plan')->where(array('member_id'=>$member_id))->select();
		foreach($plan as $k2=>$v2){
		?>
        <a value="<?php echo $v2['plan_id'];?>" title="<?php echo $v2['plan_name'];?>" data-ad-type="2" data-os="1" data-appid="0" data-target="2" data-model="RTB" onclick="getplanid($(this))"><?php echo $v2['plan_name'];?></a>
                <?php } ?>
          </span></label>
              <label for="ad_plan_id" generated="true" class="error"></label>
            </dd>
          </dl>
        </div>
        
        
        <h3 class="g-ct-title f-cb"> <span class="f-fl">定向设置</span></h3>
        <div class="module">
          <dl class="f-cb">
            <dt>地域: </dt>
            <dd>
              <div id="plan-area">
                <div>
                  <div class="area-type-radio-box">
                    <label style="margin-right: 30px">
                      <input class="f-vam" type="radio" name="data[region]" value="-1" checked="checked" onclick="ronshow(2)">
                      不限 </label>
                    <label>
                      <input class="f-vam" type="radio" name="data[region]" value="0" onclick="ronshow(1)">
                      指定地域 </label>
                      
                      
                      <div class="row">
            <link rel="stylesheet" href="css/RegionalChoice.css" />
            
            <!-- 模态框（Modal） -->
            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="position: absolute;">
              <div class="modal-dialog modal-lg">
                <div class="modal-content">
                  <div class="modal-body">
                    <div class="test-div" style="display:none;"> </div>
                     <a class="c-button-01 closer" onclick="ronshow(2)" style="display:none;">确定</a>
                  </div>
                 
                </div>
                
              </div>
            </div>
            <script src="js/jquery.min.js"></script> 
            <script src="js/bootstrap.min.js"></script> 
            <script src="js/RegionalChoice.js"></script> 
            <script>
    $(function () {
        //------生成地区
        GetRegionPlug();
		
		//var param=[ "哈尔滨市", "齐齐哈尔市", ",黑河市", "大庆市"];
		//SetChecked(param);
		
        //------选择后确定按钮
    })
</script> 
          </div>
          
          
                  </div>
                  
                  <div class="area-editor" style="display: none ">已选择指定地域<em>编辑</em></div>
                </div>
              </div>
            </dd>
          </dl>
          <dl class="f-cb">
            <dt>人群: </dt>
            <dd>--受众描述-- <span class="f-red js-crowd-ios-tip" style="display:none">iOS流量的受众描述定向仅支持在360人群管家中上传的iOS人群</span> </dd>
          <!--  <dd class="f-clear" style="margin-left:120px;width:1100px" id="crowd_dd">
            <?php
		$input_p = M('input')->where(array('input_pid'=>572))->select();
		foreach($input_p as $k2=>$v2){
		?>
              <label class="js-product-limit">
                <input class="f-vam" type="radio" id="szms" name="data[szms]" value="<?php echo $v2['input_value'];?>"<?php if($v2['input_value']==$list['szms'])echo ' checked';?>>
                <?php echo $v2['input_name'];?> <i class="f-efonts f-fs14 j-tips" data-tips="不限定人群投放"></i>&nbsp;&nbsp;&nbsp;&nbsp;</label>
            <?php }?>

            </dd>
            -->
            
            
            <dd class="f-clear sex" style="margin-left:120px;width:1100px"> <span style="display:inline-block;text-align:right;width:60px">兴趣特征：</span>
            <?php
		$input_p = M('input')->where(array('input_pid'=>660))->select();
              $valarr=unserialize($list['xqtz']);
		foreach($input_p as $k2=>$v2){
		?>
              <label>
                <input class="f-vam" type="checkbox" id="xqtz" name="data[xqtz][]" value="<?php echo $v2['input_value'];?>"<?php if(in_array($v2['input_value'],$valarr))echo ' checked="checked"';?>>
                <?php echo $v2['input_name'];?></label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <?php }?>
              
              
              
            </dd>
            
            
            <dd class="f-clear sex" style="margin-left:120px;width:1100px"> <span style="display:inline-block;text-align:right;width:60px">关键词：</span>
            <input id="keywords" class="c-input required" type="text" name="data[keywords]" maxlength="32" value="<?php echo $list['keywords'];?>">
              
            </dd>
            
            <dt class="f-clear">&nbsp; </dt>
            <dd>--人口属性-- <span class="f-red f-dn js-note" style="display: none;">温馨提示：过多的定向规则会降低广告展现量，例如同时选择兴趣，性别，人生阶段定向。建议提高出价或减少人群定向规则来提高展现量</span> </dd>
            
            
            
            <dd class="f-clear sex" style="margin-left:120px;width:1100px"> <span style="display:inline-block;text-align:right;width:60px">性别：</span>
            <?php
		$input_p = M('input')->where(array('input_pid'=>576))->select();
		foreach($input_p as $k2=>$v2){
		?>
              <label>
                <input class="f-vam" type="radio" id="sex" name="data[sex]" value="<?php echo $v2['input_value'];?>"<?php if($v2['input_value']==$list['sex'])echo ' checked';?>>
                <?php echo $v2['input_name'];?></label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <?php }?>
              
              
              
            </dd>
            
            
            <dd class="f-clear sex" style="margin-left:120px;width:1100px"> <span style="display:inline-block;text-align:right;width:60px">指定年龄：</span>
            <?php
		$input_p = M('input')->where(array('input_pid'=>602))->select();
		$valarr=unserialize($list['age']);
		foreach($input_p as $k2=>$v2){
		?>
              <label>
                <input class="f-vam" type="checkbox" id="age" name="data[age][]" value="<?php echo $v2['input_value'];?>"<?php if(in_array($v2['input_value'],$valarr))echo ' checked="checked"';?>>
                <?php echo $v2['input_name'];?></label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <?php }?>
              
              
              
            </dd>
            
            
            
            
            <dd class="f-clear sex" style="margin-left:120px;width:1100px"> <span style="display:inline-block;text-align:right;width:90px">指定人生阶段：</span>
            <?php
		$input_p = M('input')->where(array('input_pid'=>608))->select();
		$valarr=unserialize($list['rsjd']);
		foreach($input_p as $k2=>$v2){
		?>
              <label>
                <input class="f-vam" type="checkbox" id="rsjd" name="data[rsjd][]" value="<?php echo $v2['input_value'];?>"<?php if(in_array($v2['input_value'],$valarr))echo ' checked="checked"';?>>
                <?php echo $v2['input_name'];?></label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <?php }?>
              
              
            </dd>
            
            
          </dl>
          
          <dl class="f-cb">
            <dt>设备: </dt>
            <dd>--设备类型-- </dd>
            <dd class="f-clear" style="margin-left:120px;width:1100px">
             <?php
		$input_p = M('input')->where(array('input_pid'=>580))->select();
		foreach($input_p as $k2=>$v2){
		?>
              <label>
                <input class="f-vam" type="radio" id="sblx" name="data[sblx]" value="<?php echo $v2['input_value'];?>"<?php if($v2['input_value']==$list['sblx'])echo ' checked';?>>
                <?php echo $v2['input_name'];?></label>
              &nbsp;&nbsp;&nbsp;&nbsp;
              <?php }?>
              
              </dd>
            <dt class="f-clear">&nbsp; </dt>
            <dd>--网络环境-- </dd>
            <dd class="f-clear" style="margin-left:120px;width:1100px">
            <?php
		$input_p = M('input')->where(array('input_pid'=>584))->select();
		foreach($input_p as $k2=>$v2){
		?>
              <label>
                <input class="f-vam" type="radio" id="wlhj" name="data[wlhj]" value="<?php echo $v2['input_value'];?>"<?php if($v2['input_value']==$list['wlhj'])echo ' checked';?>>
                <?php echo $v2['input_name'];?></label>
              &nbsp;&nbsp;&nbsp;&nbsp;
              <?php }?>
              </dd>
          </dl>
          
          
        <h3 class="g-ct-title f-cb"> <span class="f-fl">出价</span></h3>
        <div class="module">
          
          <dl class="f-cb">
            <dt>点击出价&nbsp;<em class="f-red">*</em> </dt>
            <dd>
              <p>
                <input name="data[price]" class="c-input required number" style="width:100px" type="text" min="0.1" max="999" value="<?php echo $list['price'];?>" placeholder="">
                &nbsp;元
                <label class="error" generated="true" for="price"></label>
                <label class="f-red v-ali-m" id="suggest_price">&nbsp;&nbsp;建议出价(￥)：0.30-0.41</label>
                &nbsp;&nbsp;&nbsp;&nbsp; </p>
              <p id="price_tip" class="f-gray">为保证广告正常展示，您的出价不能低于0.1元。</p>
            </dd>
          </dl>
          
          <dl class="f-cb">
            <dt>&nbsp; </dt>
            <dd> <a id="submit" class="c-button-01" href="javascript:adsubmit()">保存并继续</a>&nbsp; <a id="cancel" class="c-button-02" href="<?php echo session('listurl');?>">取消</a>
            </dd>
          </dl>
        </div>
        <input type="hidden" name="_csrf" value="bklIUnc0N3YIfiMeEGt1ETEMDCAcc28gLHA/MBEAAgM9OQsIJXFeQw==">
      </form>
    </div>
  </div>
</div>
        </div>


<script>
function adsubmit(){
	getregion();
	$('#group-form').submit();
}
function getplanid(obj)
{
	$("#plan_id").val(obj.attr("value"));
	$(".w-select-button").html(obj.html());
}
function ronshow(i)
{
	if(i==1)
	{
		$('.test-div').show();
		$('.closer').show();
	}
	else
	{
		$('.test-div').hide();
		$('.closer').hide();
	}
}

function return_message()
{
	<?php $input = M('input')->where(array('type_id'=>$type_id,'show_switch'=>2,'required_switch'=>2,'input_pid'=>array('exp','is null')))->order('date asc')->select();  foreach($input as $k=>$v){?>
	if($("#<?php echo $v['field_name'];?>").val()=='')
	{
		alert("<?php echo $v['prompt'];?>");
		return false;
	}
	<?php }?>
}

</script> 



<?php require APP_ROOT.'public/bottom.php';?>


